package com.ylbh.modules.toconfigure.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ylbh.common.utils.ShiroUtils;
import com.ylbh.modules.toconfigure.entity.ShoppingSettings;
import com.ylbh.modules.toconfigure.mapper.ShoppingSettingsMapper;
import com.ylbh.modules.toconfigure.service.ShoppingSettingsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author: czx
 * @date: 2019/08/06 10:05
 * 平台配置
 */
@Service
public class ShoppingSettingsServiceImpl extends ServiceImpl<ShoppingSettingsMapper, ShoppingSettings> implements ShoppingSettingsService {

    @Autowired
    private ShoppingSettingsMapper shoppingSettingsMapper;

    /**
     * 获取推广订单奖励
     * @return
     */
    @Override
    public ShoppingSettings getOrderAward() {
        return shoppingSettingsMapper.selectOrderAward();
    }

    /**
     * 修改推广订单奖励
     * @param shoppingSettings
     */
    @Override
    public void modifyOrderAwardById(ShoppingSettings shoppingSettings) {
        shoppingSettings.setUpdateTime(new Date());
        shoppingSettings.setUpdateUserId(ShiroUtils.getUserId().intValue());
        shoppingSettingsMapper.updateOrderAWardById(shoppingSettings);
    }

}
